package com.restaurant.po;

import java.util.Date;
import java.util.List;

public class Order {
    private Integer id;
    private Integer customerId;
    private Date orderDate;

    // 一对多关联：一个订单对应多个订单详情
    private List<OrderDetail> orderDetails;
    // 一对一关联：订单对应的顾客
    private Customer customer;

    // 构造方法
    public Order() {}

    public Order(Integer customerId) {
        this.customerId = customerId;
    }

    // Getter和Setter方法
    public Integer getId() { return id; }
    public void setId(Integer id) { this.id = id; }

    public Integer getCustomerId() { return customerId; }
    public void setCustomerId(Integer customerId) { this.customerId = customerId; }

    public Date getOrderDate() { return orderDate; }
    public void setOrderDate(Date orderDate) { this.orderDate = orderDate; }

    public List<OrderDetail> getOrderDetails() { return orderDetails; }
    public void setOrderDetails(List<OrderDetail> orderDetails) { this.orderDetails = orderDetails; }

    public Customer getCustomer() { return customer; }
    public void setCustomer(Customer customer) { this.customer = customer; }

    @Override
    public String toString() {
        return "Order{id=" + id + ", customerId=" + customerId +
                ", orderDate=" + orderDate + "}";
    }
}